package ssm.service;

import org.apache.ibatis.jdbc.Null;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ssm.dao.Teacher;
import ssm.dao.Yhzpb;
import ssm.dao.YktCarinfo;
import ssm.model.TeacherMapper;
import ssm.model.YhzpbMapper;
import ssm.model.YktCarinfoMapper;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherMapper teacherMapper;

    @Autowired
    private YktCarinfoMapper yktCarinfoMapper;

    @Autowired
    private YhzpbMapper yhzpbMapper;

    public Teacher getByGh(String gh) {
        Teacher teach = teacherMapper.getByGh(gh);
        if (!(teach == null)) {
            YktCarinfo carInfo = yktCarinfoMapper.getByGh(gh);
            teach.setYktCarinfo(carInfo);
            Yhzpb yhzpb = yhzpbMapper.findByJid(gh);
            if (yhzpb != null) {
                byte[] zp = yhzpb.getZp();
                System.out.println(zp);
                teach.setZp(zp);
            }
        }

        return teach;
    }
}
